#ifndef NDT_BASE_SCENE_H
#define NDT_BASE_SCENE_H

// 所有扫描scene的基类
#include <QGraphicsScene>
#include <QMainWindow>
#include <QMutex>
#include <QTimer>
#include "ndt_base_view.h"

namespace eintik::presentation::viewcore {

class NdtScanScene : public QGraphicsScene
{
    Q_OBJECT

public:
    explicit NdtScanScene(QObject *parent = nullptr);
    ~NdtScanScene() Q_DECL_OVERRIDE;

    virtual void init();

    virtual void updateScan(bool f = false);

    virtual void updateRulers(void);

    virtual void setColorMap(const QVector<QColor> &colorVector);

    VIEW_TYPE getViewType(void) const;

protected:
    void setRefreshDataTimerOn(bool f = false);
    // 延迟33ms刷新图像，避免刷新太快了，当然第一帧是立刻显示出来的。

    QVector<QColor> colorMap;
    QVector<QRgb> colorTable;

    QTimer refreshDataTimer;
    int32_t displayInterval = 50;

    NdtScanView *View = nullptr;
    bool hightLight = false;
    VIEW_TYPE Type;

private:
    QGraphicsTextItem *scanNameItem = nullptr;

signals:
    void signalRefreshDataTimerStart(bool);

public slots:
    virtual void slotRefreshDataTimerStart(bool);
    virtual void slotRefreshDataTimeout(void);

    virtual void setScanView(NdtScanView *view);

    bool sceneVisible();
};

}
#endif // NDT_BASE_SCENE_H
